package net.paoding.rose.jade.statement.jexl.internal.introspection;

import org.apache.commons.jexl3.introspection.JexlPermissions;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author zhangfusheng
 * @date 2024/5/20
 */
public class RosePermissions implements JexlPermissions {

    public static final JexlPermissions JEXL_PERMISSIONS = new RosePermissions();

    private final JexlPermissions jexlPermissions;

    private RosePermissions(Class<?>... allow) {
        this.jexlPermissions = new JexlPermissions.ClassPermissions(allow);
    }

    @Override
    public boolean allow(Package pack) {
        return true;
    }

    @Override
    public boolean allow(Class<?> clazz) {
        return true;
    }

    @Override
    public boolean allow(Constructor<?> ctor) {
        return true;
    }

    @Override
    public boolean allow(Method method) {
        return true;
    }

    @Override
    public boolean allow(Field field) {
        return true;
    }

    @Override
    public JexlPermissions compose(String... src) {
        return this.jexlPermissions.compose(src);
    }
}
